<template>
  <div 
    class="editor-card" 
    :class="{ 'with-shadow': props.shadow }"
    :style="cardStyle"
  >
    <div v-if="props.showTitle" class="card-title" :style="{ color: props.titleColor }">
      {{ props.title }}
    </div>
    <div class="card-content">
      <slot>
        <div class="placeholder-content">卡片内容区域</div>
      </slot>
    </div>
  </div>
</template>

<script setup lang="ts">
import { defineProps, computed } from 'vue';

const props = defineProps({
  title: {
    type: String,
    default: '卡片标题'
  },
  showTitle: {
    type: Boolean,
    default: true
  },
  shadow: {
    type: Boolean,
    default: true
  },
  borderRadius: {
    type: Number,
    default: 8
  },
  padding: {
    type: Number,
    default: 15
  },
  backgroundColor: {
    type: String,
    default: '#ffffff'
  },
  titleColor: {
    type: String,
    default: '#333333'
  },
  borderColor: {
    type: String,
    default: '#f0f0f0'
  }
});

const cardStyle = computed(() => {
  return {
    borderRadius: `${props.borderRadius}px`,
    padding: `${props.padding}px`,
    backgroundColor: props.backgroundColor,
    borderColor: props.borderColor
  };
});

defineOptions({
  name: 'editor-card'
});
</script>

<style lang="scss" scoped>
.editor-card {
  width: 100%;
  border: 1px solid;
  box-sizing: border-box;
  
  &.with-shadow {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  }
  
  .card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
  }
  
  .placeholder-content {
    color: #999;
    font-size: 14px;
    text-align: center;
    padding: 20px 0;
  }
  
  &:hover {
    outline: 1px dashed #ccc;
  }
}
</style> 